//
//  DDGoodsCollectionCell.m
//  Dingdong
//
//  Created by 程强 on 16/11/14.
//  Copyright © 2016年 程强. All rights reserved.
//

#import "DDGoodsCollectionCell.h"

@implementation DDGoodsCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.goodsImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 00, 0)];
        [self.contentView addSubview:_goodsImage];
        _goodsImage.image = LoadImage(@"category_test");
        [_goodsImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.top.equalTo(self.contentView).offset(5.0);
            make.width.equalTo(self.contentView).offset(-10.0);
            make.height.equalTo(_goodsImage.mas_width).multipliedBy(1.0);
        }];
        
        self.goodsNameLbl = [[KKLabel alloc]initWithBlock:^(KKLabel *lbl) {
            lbl.laText(@"iPhone7国行开放版",[UIColor blackColor],[UIFont systemFontOfSize:12.0],NSTextAlignmentLeft);
        }];
        [self.contentView addSubview:_goodsNameLbl];
        [_goodsNameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(10);
            make.right.equalTo(self.contentView).offset(-10);
            make.top.equalTo(self.goodsImage.mas_bottom).offset(3);
            make.height.equalTo(@20);
        }];
        
        self.originalPriceLbl = [[KKLabel alloc]initWithBlock:^(KKLabel *lbl) {
            lbl.laText(@"$140",[UIColor darkGrayColor],[UIFont systemFontOfSize:10.0],NSTextAlignmentLeft);
        }];
        [self.contentView addSubview:_originalPriceLbl];
        [_originalPriceLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15);
            make.top.equalTo(_goodsNameLbl.mas_bottom).offset(5);
            make.width.equalTo(@40);
            make.height.equalTo(@20);
        }];
        
        self.nowPriceLbl = [[KKLabel alloc]initWithBlock:^(KKLabel *lbl) {
            lbl.laText(@"$120",[UIColor redColor],[UIFont systemFontOfSize:12.0],NSTextAlignmentLeft);
        }];
        [self.contentView addSubview:_nowPriceLbl];
        [_nowPriceLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.originalPriceLbl.mas_right).offset(0);
            make.top.equalTo(_goodsNameLbl.mas_bottom).offset(5);
            make.width.equalTo(@60);
            make.height.equalTo(@20);
        }];
    }
    return self;
}
@end
